SPRING BOOT: Logging / AOP Annotations / Log4j - Configure - Properties 41
3
3
.
.
2
2
A
A
O
O
P
P
A
A
n
n
n
n
o
o
t
t
a
a
t
t
i
i
o
o
n
n
s
s
I
I
n
n
f
f
o
o
[
[
R
R
]
]
Following tutorials show how to use AOP Annotations to log events.
AOP stands for Aspect Orientated Programming.
AOP is a way for adding behavior to existing code without modifying that code.
By using Annotations business logic code isn't polluted with logging code.
Examples
Signature method = joinPoint.getSignature(); //String com.ivoronline...MyController.hello()
String classPathName = method.getDeclaringTypeName(); //com.ivoronline...controllers.MyController
String methodName = method.getName(); //hello
Class methodClass = method.getDeclaringType(); //class com.ivoronline...controllers.MyController
String classPathName2 = methodClass.getName(); //com.ivoronline...controllers.MyController
String packageName = methodClass.getPackageName(); //com.ivoronline...controllers
String className = methodClass.getSimpleName(); //MyController